/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package modelo;

import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Francisco
 */
@Entity
@Table(name = "operar_consumo_ingreso")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "OperarConsumoIngreso.findAll", query = "SELECT o FROM OperarConsumoIngreso o"),
    @NamedQuery(name = "OperarConsumoIngreso.findByIdOperarConsumoIngreso", query = "SELECT o FROM OperarConsumoIngreso o WHERE o.idOperarConsumoIngreso = :idOperarConsumoIngreso"),
    @NamedQuery(name = "OperarConsumoIngreso.findByMonto", query = "SELECT o FROM OperarConsumoIngreso o WHERE o.monto = :monto")})
public class OperarConsumoIngreso implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_operar_consumo_ingreso")
    private Integer idOperarConsumoIngreso;
    // @Max(value=?)  @Min(value=?)//if you know range of your decimal fields consider using these annotations to enforce field validation
    @Basic(optional = false)
    @NotNull
    @Column(name = "monto")
    private BigDecimal monto;
    @JoinColumn(name = "id_operar_consumo", referencedColumnName = "id_operar_consumo")
    @ManyToOne(optional = false)
    private OperarConsumo idOperarConsumo;
    @JoinColumn(name = "id_ingreso", referencedColumnName = "id_ingreso")
    @ManyToOne(optional = false)
    private Ingreso idIngreso;

    public OperarConsumoIngreso() {
    }

    public OperarConsumoIngreso(Integer idOperarConsumoIngreso) {
        this.idOperarConsumoIngreso = idOperarConsumoIngreso;
    }

    public OperarConsumoIngreso(Integer idOperarConsumoIngreso, BigDecimal monto) {
        this.idOperarConsumoIngreso = idOperarConsumoIngreso;
        this.monto = monto;
    }

    public Integer getIdOperarConsumoIngreso() {
        return idOperarConsumoIngreso;
    }

    public void setIdOperarConsumoIngreso(Integer idOperarConsumoIngreso) {
        this.idOperarConsumoIngreso = idOperarConsumoIngreso;
    }

    public BigDecimal getMonto() {
        return monto;
    }

    public void setMonto(BigDecimal monto) {
        this.monto = monto;
    }

    public OperarConsumo getIdOperarConsumo() {
        return idOperarConsumo;
    }

    public void setIdOperarConsumo(OperarConsumo idOperarConsumo) {
        this.idOperarConsumo = idOperarConsumo;
    }

    public Ingreso getIdIngreso() {
        return idIngreso;
    }

    public void setIdIngreso(Ingreso idIngreso) {
        this.idIngreso = idIngreso;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idOperarConsumoIngreso != null ? idOperarConsumoIngreso.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof OperarConsumoIngreso)) {
            return false;
        }
        OperarConsumoIngreso other = (OperarConsumoIngreso) object;
        if ((this.idOperarConsumoIngreso == null && other.idOperarConsumoIngreso != null) || (this.idOperarConsumoIngreso != null && !this.idOperarConsumoIngreso.equals(other.idOperarConsumoIngreso))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "modelo.OperarConsumoIngreso[ idOperarConsumoIngreso=" + idOperarConsumoIngreso + " ]";
    }
    
}
